import React, { useState } from 'react';
import { ConfigProvider, Spin, message } from 'antd';
import type { AppProps } from 'next/app';

import theme from './theme/themeConfig';
import zhCN from 'antd/locale/zh_CN';
import 'dayjs/locale/zh-cn';
const App = ({ Component, pageProps }: AppProps) => {
  const [messageApi, contextHolder] = message.useMessage();
  const [spinning, setSpinning] = useState(false)
  return (
    <ConfigProvider theme={theme} locale={zhCN}>
      {contextHolder}
      <Spin spinning={spinning} tip="玩命加载中……">
        <Component {...pageProps} messageApi={messageApi} setSpinning={setSpinning} />
      </Spin>
    </ConfigProvider>
  );
};

export default App;
